//
//  YDBaseViewModel.h
//  IngCard
//
//  Created by kf on 2017/5/23.
//  Copyright © 2017年 IngDan. All rights reserved.
//

#ifndef YDBaseViewModel_h
#define YDBaseViewModel_h
#import "YDBaseTableViewController.h"

@protocol YDViewDataSource <NSObject>
@property(nonatomic, assign) CGFloat height;
@required
@property(nonatomic, readonly) CGFloat viewHeight;

@optional
@property(nonatomic, readonly) CGFloat viewWidth;

-(Class)viewClass;
@end


@protocol YDViewDelegate <NSObject>
/**
 每一个View的回调函数，理论上类型应该是id<YDUIViewModel
 */
-(void) viewDidSelected:(UIView *) view
                eventId:(NSInteger) eventId
               userInfo:(NSDictionary *) userInfo;
@end




@protocol YDViewProtocol <NSObject>

@property(nonatomic, weak) id<YDViewDelegate> delegate; //通常指向父VC

@property(nonatomic, weak) id<YDViewDataSource> dataSource;

@required

/**
 对于一个View，当知道ViewModel时，一定有静态方法，能计算出View的宽和高
 */
+(CGFloat)viewHeight:(id<YDViewDataSource>) dataSource;

@optional
+(CGFloat)viewWidth:(id<YDViewDataSource>) dataSource;

@end


#endif /* YDBaseViewModel_h */
